package com.zyp.test.test;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

/**
 * @author zyp
 *         2017/12/20
 */

public class MyButton extends View {
    public MyButton(Context context) {
        super(context);
    }

    public MyButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        Log.d("MyButton","dispatchTouchEvent:" +event.getAction());
       /* switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                Log.d("MyButton","dispatchTouchEvent:" +"ACTION_DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d("MyButton","dispatchTouchEvent:" +"ACTION_MOVE");
                break;
            case MotionEvent.ACTION_UP:
                Log.d("MyButton","dispatchTouchEvent:" +"ACTION_UP");
                break;
        }*/
        return super.dispatchTouchEvent(event);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.d("MyButton","onTouchEvent:" +event.getAction());
        /*switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                Log.d("MyButton","onTouchEvent:" +"ACTION_DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d("MyButton","onTouchEvent:" +"ACTION_MOVE");
                break;
            case MotionEvent.ACTION_UP:
                Log.d("MyButton","onTouchEvent:" +"ACTION_UP");
                break;
        }*/
        return false;
    }
}
